import { Controller } from 'egg';

export default class BaseController extends Controller {
  success(data, status = 200) {
    this.ctx.body = { code: 200, data };
    this.ctx.status = status;
  }

  fail(code, message) {
    this.ctx.body = { code, message, data: {} };
    this.ctx.status = code;
  }
}
